﻿using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using QuickTest.Core.Compilation;
using QuickTest.Services.TextRetrieval;

namespace QuickTest.Tests.Services.TextRetrieval
{
    [TestFixture]
    public class FileTextRetrieverTests
    {
        private const string FilePath = TestUtils.TestDirectory + "/TestFile.txt";

        [Test]
        [Category("Integration")]
        public void Can_GetText()
        {
            try
            {
                TestUtils.CreateTestFile(EmbeddedResourceTextRetrieverTests.EmbeddedResourcePath, FilePath);
                var textRetriever = new FileTextRetriever(new FileUri(FilePath));

                Assert.That(textRetriever.GetText(), Is.EqualTo(EmbeddedResourceTextRetrieverTests.EmbeddedResourceText), "Should have returned same text as in QuickTest.Tests.Artifacts.EmbeddedResource.txt.");
            }
            finally
            {
                TestUtils.DeleteTestFiles();
            }
        }
    }
}